export const setItem = (key, value) => {
    localStorage.setItem(key, JSON.stringify(value))
}

export const getItem = (key) => {
    let val = localStorage.getItem(key) ? localStorage.getItem(key) : null
    if (val) {
        return JSON.parse(localStorage.getItem(key))
    } else {
        return null
    }
}

export const removeItem = (key) => {
    localStorage.removeItem(key)
}

export const clear = () => {
    localStorage.clear()
}